<?php
require 'dbcon.php';
 $empe_id=isset($_GET['e_id']) ? $_GET['e_id']:0;
 if(empty ($_POST))
 {
      $rs=$db->query("select*from tb_emp where e_id='{$empe_id}'");
      $k=$rs->fetch_assoc();
      require("edit_html.php");
 }
 else{
   $ename=$_REQUEST['e_name'];
   $e_dept=$_REQUEST['e_dept'];
   $e_img=$_REQUEST['e_img'];
   $date_of_birth=$_REQUEST['date_of_birth'];
   $date_of_entry=$_REQUEST['date_of_entry'];
 $sql="update tb_emp set e_name='$ename',e_dept='$e_dept',e_img='$e_img',date_of_birth='$date_of_birth',date_of_entry='$date_of_entry' where e_id='{$empe_id}'";
//echo $sql;
//exit;
 $rs=$db->query($sql);
 if ($rs==true)
 {
     echo "<script language='javascript' type='text/javascript'>";
     echo "alert('修改成功!');";
     echo "window.location.href='index.php';";
     echo "</script>";
 }
 else{
      echo "<script language='javascript' type='text/javascript'>";
     echo "alert('修改失败!');";
     echo "window.location.href='index.php';";
     echo "</script>";
 }
 }
